define(['text!./blooding.html', 'css!./blooding.css', 'echarts'], function(html) {
	avalon.templateCache['blooding'] = html;
	var vm = avalon.define({
		$id: "blooding",
		back: function() {
			Router.go('/basic/basic');
		},
		member: {},
		getData: function() {
			var member = JSON.parse(getstorage('member'));
			var myDate = new Date();
			var time = myDate.toLocaleDateString().replace(/\//g, '-');;
			httpPost('measuremsg/getMeasureMsg', {
				userId: member.idu,
				type: '001',
				time: '2016-12-19'
			}).done(function(data) {
				if("200" == data.code) {
					if(data.items.length == 0) {
						myChart.clear();
					} else {
						for(var i = 0; i < data.items.length; i++) {
							option.xAxis[0].data[i] = data.items[i].createTime;
							option.series[0].data[i] = data.items[i].sbp;
							option.series[1].data[i] = data.items[i].dbp;
						}
						myChart.clear();
						myChart.setOption(option);
					}
				} else {
					msgbox('提示', data.msg);
				}
			});
		},
		init: function() {
			if(getstorage('user')) {
				vm.member = JSON.parse(getstorage('member'));
			};
			vm.getData();
		}
	});
});